package cn.yuyiling.jelly.kg.mapper;

import cn.yuyiling.jelly.kg.dto.KnowledgePointDTO;
import cn.yuyiling.jelly.kg.mongodb.entity.KnowledgePoint;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface KnowledgePointMapper {

    KnowledgePointMapper INSTANCE = Mappers.getMapper(KnowledgePointMapper.class);

    @Mapping(source = "name", target = "name")
    @Mapping(source = "content", target = "content")
    @Mapping(source = "tags", target = "metadata.tags")
    @Mapping(source = "category", target = "category")
    KnowledgePoint dtoToEntity(KnowledgePointDTO dto);

    @Mapping(target = "name", source = "name")
    @Mapping(target = "content", source = "content")
    @Mapping(target = "tags", source = "metadata.tags")
    @Mapping(target = "category", source = "category")
    KnowledgePointDTO entityToDto(KnowledgePoint entity);
}
